/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is Forte for Java, Community Edition. The Initial * Developer of the Original Code is Sun Microsystems, Inc. Portions * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.editor.java; import javax.swing.ButtonGroup; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import org.netbeans.editor.ext.JCompletion; /** * * @author Miloslav Metelka * @version 1.0 */ class JCLevelPanel extends javax.swing.JPanel { static final long serialVersionUID =-1647135977670510564L; /** Creates new form JCLevelPanel */ JCLevelPanel(String title) { initComponents (); Border b = getBorder(); if (b instanceof TitledBorder) { ((TitledBorder)b).setTitle(title); } ButtonGroup bg = new ButtonGroup(); bg.add(publicLevel); bg.add(protectedLevel); bg.add(packageLevel); bg.add(privateLevel); } public int getLevel() { if (publicLevel.isSelected()) { return JCompletion.PUBLIC_LEVEL; } else if (protectedLevel.isSelected()) { return JCompletion.PROTECTED_LEVEL; } else if (packageLevel.isSelected()) { return JCompletion.PACKAGE_LEVEL; } else { return JCompletion.PRIVATE_LEVEL; } } public void setLevel(int level) { if (level == JCompletion.PUBLIC_LEVEL) { publicLevel.setSelected(true); } else if (level == JCompletion.PROTECTED_LEVEL) { protectedLevel.setSelected(true); } else if (level == JCompletion.PACKAGE_LEVEL) { packageLevel.setSelected(true); } else { privateLevel.setSelected(true); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints1; setBorder (new javax.swing.border.TitledBorder("Level")); // NOI18N publicLevel = new javax.swing.JRadioButton (); publicLevel.setText ("Public"); // NOI18N gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (publicLevel, gridBagConstraints1); protectedLevel = new javax.swing.JRadioButton (); protectedLevel.setSelected (true); protectedLevel.setText ("Protected and public"); // NOI18N gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (protectedLevel, gridBagConstraints1); packageLevel = new javax.swing.JRadioButton (); packageLevel.setText ("All except private"); // NOI18N gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (packageLevel, gridBagConstraints1); privateLevel = new javax.swing.JRadioButton (); privateLevel.setText ("All"); // NOI18N gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; add (privateLevel, gridBagConstraints1); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton publicLevel; private javax.swing.JRadioButton protectedLevel; private javax.swing.JRadioButton packageLevel; private javax.swing.JRadioButton privateLevel; // End of variables declaration//GEN-END:variables } /* * Log * 4 Gandalf 1.3 1/13/00 Miloslav Metelka Localization * 3 Gandalf 1.2 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 2 Gandalf 1.1 8/9/99 Ian Formanek Generated Serial Version * UID * 1 Gandalf 1.0 7/20/99 Miloslav Metelka * $ */